package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswProductSpecifications;

@Mapper
public interface TswProductSpecificationsDao {

    @Select("select * from tsw_product_specifications t where t.id = #{id}")
    TswProductSpecifications getById(Long id);

    @Delete("delete from tsw_product_specifications where id = #{id}")
    int delete(Long id);

    int update(TswProductSpecifications tswProductSpecifications);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_product_specifications(specifications_no, product_id, hair_material, hair_color, handle_material, handle_color, tube_material, tube_color, allocation, specifications_name, manufacturer, shelf_life, suitable_skin_types, effect, product_description, cost_price, internal_price, marketing_price, unsold_inventory, undistributed_inventory, virtual_sales, beensold_number, image_path_ids, state, create_time, specifications_note, specifications_remark) values(#{specificationsNo}, #{productId}, #{hairMaterial}, #{hairColor}, #{handleMaterial}, #{handleColor}, #{tubeMaterial}, #{tubeColor}, #{allocation}, #{specificationsName}, #{manufacturer}, #{shelfLife}, #{suitableSkinTypes}, #{effect}, #{productDescription}, #{costPrice}, #{internalPrice}, #{marketingPrice}, #{unsoldInventory}, #{undistributedInventory}, #{virtualSales}, #{beensoldNumber}, #{imagePathIds}, #{state}, #{createTime}, #{specificationsNote}, #{specificationsRemark})")
    int save(TswProductSpecifications tswProductSpecifications);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswProductSpecifications> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
